import { FC, useEffect } from 'react';
import { useSelector, useDispatch } from 'umi';
import { ItemType } from '../models/models';

const Index: FC = () => {
  const list = useSelector((state: any) => state.todolist.list);
  // const dispatch = useDispatch();

  // useEffect(() => {
  //   dispatch({
  //     type: 'todolist/asyncGetData',
  //   });
  // }, []);

  return (
    <ul>
      {list.map((item: ItemType) => {
        return <li key={item._id}>{item.title}</li>;
      })}
    </ul>
  );
};

export default Index;
